export function isFunction(val) {
    return typeof val === 'function';
}

export function isObject(val) {
    return typeof val == 'object' && val !== null

}

// 当前的next函数和用户使用的$nextTick函数为同一个函数


const callbacks = []
function flushCallbacks() {
  callbacks.forEach(cb => cb())
  waiting = false
}
let waiting = false
export function nextTick(cb) {
  callbacks.push(cb)
  // console.log(callbacks)
  if (!waiting) {
    Promise.resolve().then(() => {
      flushCallbacks()
    })
    waiting = true
  }
  
}